07. SQLAlchemy ORM

SQLAlchemy ORM Heading

SQLAlchemy ORM

ND004 C01 L03 07 SQLAlchemy ORM

SQLAlchemy ORM Recap

Takeaways

SQLAlchemy ORM

  • Lets you compose SQL expressions by mapping python classes of objects to tables in the database
  • Is the highest layer of abstraction in SQLALchemy.
  • Wraps the SQL Expressions and Engine to work together to interact with the database
  • Will be used in this course, so we can know how to use ORM libraries in general.

Moreover, SQLAlchemy is split into two libraries:

  • SQLAlchemy Core
  • SQLAlchemy ORM (Object Relational Mapping library). SQLALchemy ORM is offered as an optional library, so you don't have to use the ORM in order to use the rest of SQLAlchemy.
    • The ORM uses the Core library inside
    • The ORM lets you map from the database schema to the application's Python objects
    • The ORM persists objects into corresponding database tables

SQLAlchemy Layers of Abstraction Overview (Diagram)

QUIZ QUESTION: :

Below are some of SQLAlchemy's layers of abstraction—can you match the description with the name?

ANSWER CHOICES:



Description

Which layer of abstraction?

The engine layer

The ORM layer

The dialect layer

The SQL expressions layer

The connection pool layer

SOLUTION:

Description

Which layer of abstraction?

The engine layer

The ORM layer

The dialect layer

The SQL expressions layer

The connection pool layer